<?php defined('SYSPATH') or die('No direct script access.');
/**
 * Basic posts model. To use it, create a model that extends this class:
 *
 *     class Model_Post extends Sprig_Model_Posts {}
 *
 * @package    Flosee
 * @author     Andy Taylor
 * @copyright  (c) 2010 Flosee Ltd.
 * @license    BSD
 */
abstract class Sprig_Model_Post extends Sprig {

	protected $_title_key = 'id';

	protected $_sorting = array('id' => 'desc');

	protected function _init()
	{
		$this->_fields += array(
			'id' => new Sprig_Field_Auto,
			'author' => new Sprig_Field_Integer(array(
				'empty'  => FALSE,
				'editable' => FALSE,
			)),
			'date' => new Sprig_Field_Timestamp(array(
				'empty' => FALSE,
				'format' => "Y-m-d H:i:s",
				'auto_now_create' => TRUE,
				'editable' => FALSE,
			)),
			'edit' => new Sprig_Field_Timestamp(array(
				'empty' => TRUE,
				'format' => 'Y-m-d H:i:s',
				'auto_now_update' => TRUE,
				'editable' => TRUE,
			)),
			'content' => new Sprig_Field_Text(array(
				'empty' => FALSE,
				'editable' => TRUE,
			)),
			'title' => new Sprig_Field_Text(array(
				'empty' => FALSE,
				'editable' => TRUE,
			)),
			'tags' => new Sprig_Field_Text(array(
				'empty' => FALSE,
				'editable' => TRUE,
			)),
		);
	}
} // End Posts
